Report post

How to comment out JavaScript code?

There are two ways you can comment out the code in JavaScript, and they are: 1. Single line comment A single-line comment is a type of comment that will create one line of comment. You can do this by adding double forward slashes // at the start of the JavaScript code. Any code between // and the end of the statement will be ignored by JavaScript.

What is a multiple-line comment in JavaScript?

A multiple-line comment is a type of comment that will create multiple lines of comment. You can do this by adding a forward slash with an asterisk /* at the start and then an asterisk with a forward slash */ at the end of the JavaScript code. Any code between /* and */ will be ignored by JavaScript.

How do I use a block comment in a document?

document.getElementById("myP").innerHTML = "My first paragraph."; It is most common to use single line comments. Block comments are often used for formal documentation. Using comments to prevent execution of code is suitable for code testing. Adding // in front of a code line changes the code lines from an executable line to a comment.

Should commented text be re-interpreted?

The answer is to fix JS. The obvious rule: EVERYTHING between the comment tags is to be treated as a comment. Period. To re-interpret commented text as functional in any way is just not sane. Commented text should not have any functional symbology.... it should not be getting parsed at all.... no excuses. Commented text should be absolutely dead.

Related articles

The World's Leading Crypto Trading Platform

Get my welcome gifts